<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PhpGrid</title>

<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="css/ie6_or_less.css" />
<![endif]-->
<script type="text/javascript" src="js/common.js"></script>
<link rel="stylesheet" href="../CodeMirror-2.24/lib/codemirror.css">
<script src="../CodeMirror-2.24/lib/codemirror.js"></script> 
 
<script src="../CodeMirror-2.24/mode/xml/xml.js"></script>
<script src="../CodeMirror-2.24/mode/javascript/javascript.js"></script>
<script src="../CodeMirror-2.24/mode/css/css.js"></script>
<script src="../CodeMirror-2.24/mode/clike/clike.js"></script>
<script src="../CodeMirror-2.24/mode/php/php.js"></script>
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
     <style type="text/css">
      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black; width: 900px;}
      .activeline {background: #e8f2ff !important;}
          <style type="text/css">
   
         
    </style>
    </style>
 <link rel="stylesheet" type="text/css" href="css/main.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/print.css" media="print" />   
</head>
<body id="type-c">
<div id="wrap">

 <?php
  include("include/header.php");
  
  ?>
	
	<div id="content-wrap">
	
 <?php
  include("include/left.php");
  $file="datagrid/examples/simple_sql.php";
  if(isset($_GET['source'])){
  	if(file_exists("../phpgrid/examples/".$_GET['source'])){
    	$file="../phpgrid/examples/".$_GET['source'];
 	}  
  }
  $source=file_get_contents($file);
  $get_source=$_GET['source'];
 
  switch($get_source){
  	case "form_few_columns.php":
	case "form_field_editor.php":
	case "form_field_type.php":
	case "form_validate.php":
	case "simple_form.php":
	case "extends_form.php":
	case "form_attributes.php":
		$get_source.="?datagrid_action=new";
	break;  
  }
  
  if( empty($get_source) )
  { 
	$get_source = 'simple_sql.php'; 
  }

  ?>
		
	  <div id="content">
		
			<div id="breadcrumb"></div>
			
			<h2>代码:</h2>
	        <table width="585" height="383" border="0">
              <tr>
                <td  valign="top">
				 
				<form><textarea id="code" name="code"  style="width:950px;height:400px;" ><?php
				echo $source;
				
				?>
				</textarea></form> 
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  mode: "application/x-httpd-php",
  lineNumbers: true,
  lineWrapping: true,
  onCursorActivity: function() {
    editor.setLineClass(hlLine, null, null);
    hlLine = editor.setLineClass(editor.getCursor().line, null, "activeline");
  }
});
var hlLine = editor.setLineClass(0, "activeline");
</script>
				</td>
              </tr>
              <tr>
                <td><h2><a href="<?="../phpgrid/examples/".$get_source?>"  target="_blank">点击直接运行</a></h2></td>
              </tr>
            </table>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
	  </div>
	  <div id="poweredby"> </div>
		
	</div>
	
</div>
</body>
</html>